import { computed } from 'vue';
import { useStore } from 'vuex';

export function useMapper(mappr, mapFn) {
    const store = useStore()
    const storeStatefn = mapFn(mappr);
    const storeState = {};
    Object.keys(storeStatefn).map(k => {
        const fn = storeStatefn[k].bind({ $store: store });
        storeState[k] = computed(fn)
    })
    return storeState
}